package org.sith.taskrunner.managedbeans;

import org.sith.taskrunner.ejb.services.TaskToolkitRegisterService;
import org.sith.taskrunner.ejb.services.WebTaskExecutorService;

import javax.annotation.PostConstruct;
import javax.ejb.EJB;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
import java.util.ArrayList;
import java.util.List;

@ManagedBean(name = "taskRunner")
@RequestScoped
public class TaskRunnerManagedBean {

    private String taskName;
    private String inputData;
    private List<String> toolkitNames;
    private String result;


    @EJB(name = "WebTaskExecutorServiceEJB")
    private WebTaskExecutorService webTaskExecutorService;
    @EJB(name = "TaskToolkitRegisterServiceEJB")
    private TaskToolkitRegisterService toolkitRegisterService;

    @PostConstruct
    public void init() {
        toolkitNames = new ArrayList<String>(toolkitRegisterService.getActiveToolkitsNames());
    }


    public String getTaskName() {
        return taskName;
    }

    public void setTaskName(String taskName) {
        this.taskName = taskName;
    }

    public String getInputData() {
        return inputData;
    }

    public void setInputData(String inputData) {
        this.inputData = inputData;
    }

    public List<String> getToolkitNames() {
        return toolkitNames;
    }

    public void setToolkitNames(List<String> toolkitNames) {
        this.toolkitNames = toolkitNames;
    }

    public String getResult() {
        return result;
    }

    public void setResult(String result) {
        this.result = result;
    }
}
